package pl.edu.agh.mgr.hotel.ws.client;

import javax.xml.ws.BindingProvider;

import com.sun.xml.ws.client.BindingProviderProperties;

import pl.edu.agh.mgr.hotel.ws.client.utility.IWSClient;

public class WSClient6 extends IWSClient {

	private final String wsAddress = "http://localhost:8081/HotelWS/services/DataService6Port";

	@Override
	public DataResponse getHotelData(DataRequest dataRequest) {

		DataService6Service ss = new DataService6Service();
		DataService6 port = ss.getDataService6Port();

		BindingProvider provider = (BindingProvider) port;
		provider.getRequestContext().put(
				BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsAddress);
		provider.getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, 60 * 1000 * 30);
		provider.getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, 60 * 1000 * 30);
		
		return port.getHotelData(dataRequest);
	}

	@Override
	public String getWsAddress() {
		return wsAddress;
	}
}
